<?php

class BlogsController extends BaseController {
        
    public function indexAction($requestData) {
    	$blogTitle = isset($requestData['arg0']) ? $requestData['arg0'] : "";
    	$sports = array("cycling", "running", "mountain-climbing", "swimming", "adventure-racing", "mountain-biking", "ironman");
    	if($blogTitle != "" && !in_array($blogTitle, $sports)) {
    		$blog = pk_blog::get(seourl($blogTitle), "title");
    		if($blog->id > 0) {
    			$this->data['blog'] = $blog;
    			return;
    		}
    	}
    	
    	$sportStr = isset($requestData['arg0']) ? $requestData['arg0'] : "";
		$featured = pk_sport::getFeaturedSport($sportStr);
    	$sport = $featured->id;
    	$this->data['featuredTitle'] = $featured->name;
    	
    	// get featured sport
    	$this->data['blogs'] = pk_blog::getBlogs($sport);
    	
    	#$this->data['sports'] = pk_sport::getAll();
		
		#$this->data['pageTitle'] = ($homepage == true) ? 'PEAK.COM: Adventure Sports, Endurance Sports, Extreme Sports, Outdoor Sports, People Inspiring People'
		#											  : $featured->sport_name. " News - PEAK.COM";
		
    	$this->data['page'] = "blogs";
    	
    	$this->data['pageTitle'] = $featured->name . " Blogs";
    }

}

?>